#ifndef LEVEL_UP_APP_H
#define LEVEL_UP_APP_H

#include <string>
#include "ofxFenster.h"
#include "ofxControlPanel.h"
#include "ofMain.h"
#include "RemoteIO.h"
#include "GameModel.h"
#include "GameController.h"
#include "InputController.h"
#include "ViewController.h"
#include "AudioController.h"
#include "OscDataSender.h"

using std::string;

class Settings;

/* Files existing in the photobooth receive directory will not be acted upon if this define is active. */
//#define IGNORE_EXISTING_PHOTOBOOTH_FILES


class LevelUpApp : public ofBaseApp, public ofxFensterListener {
public:
	static const string CONFIG_FILE;
	static const string GUI_FONT_FILE;
	static const int GUI_FONT_SIZE;
	
	bool debugDrawingEnabled;
	
	LevelUpApp( ofxFenster* fenster_ = 0 );
	
	void setup();
	void update();
	void draw();
	
	const GameModel& getGame() const;
	GameModel& getGame();
	const GameController& getGameController() const;
	GameController& getGameController();
	const ViewController& getViewController() const;
	AudioController& getAudioController();
	const OscDataSender& getOscDataSender() const;
	OscDataSender& getOscDataSender();
	
	void keyPressed( int key );
	void keyReleased( int key );
	void mouseMoved( int x, int y );
	void mouseDragged( int x, int y, int button );
	void mousePressed( int x, int y, int button );
	void mouseReleased( int x, int y, int button );
	void windowResized( int w, int h );
	
	void guiEventCallback( guiCallbackData& data );
	
	void setFullscreen( bool fs );
	void toggleFullscreen();
	
	void fensterKeyPressed  ( int key );
	void fensterKeyReleased( int key );
	void fensterMouseMoved( int x, int y );
	void fensterMouseDragged( int x, int y, int button );
	void fensterMousePressed( int x, int y, int button );
	void fensterMouseReleased ( int x, int y, int button );
	void fensterWindowResized( int w, int h );
	
	void fensterDraw();
	void fensterUpdate();
	
private:
	Settings& s;
	
	int screenModeChanged;
	ofxFenster* fenster;
	ofxControlPanel gui;
	RemoteIO remoteIO;
	
	GameModel game;
	GameController gameController;
	InputController inputController;
	ViewController viewController;
	AudioController audioController;
	OscDataSender oscDataSender;
	
	int appFrameRate;
	bool showAppFrameRate;
};

#endif /* ! LEVEL_UP_APP_H */
